import re
regex=re.compile(r'VlanId = (\d+), MacAddress = \S+, Original-Port = (\S+), Flapping port = (\S+)\.')

ports=set()
with open(r'c:\tools\log.txt') as f:
	for m in regex.finditer(f.read()):
		vlan=m.group(1)
		ports.add(m.group(2))
		ports.add(m.group(3))


print('Loop between ports {} in VLAN {}'.format(', '.join(ports),vlan))